#!/usr/bin/env bash

#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

set -e

OUT=${1:-target/recovery-sim}
mkdir -p $OUT
OUT=$(realpath $OUT)

RECOVERY_SIM_DIR=$OUT cargo test -p s2n-quic-core --lib recovery::simulation -- --nocapture

cd $OUT
# Generate an html file with a directory listing of all recovery simulations. -P is used to only include
# svg files so other files don't show up in the listing
tree -H "." -L 1 -T "Recovery Simulations" --noreport --charset utf-8 -P "*.svg" > index.html
